%%
%% This is file `xkvview.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% xkeyval.dtx  (with options: `xkvview')
%% 
%% ---------------------------------------
%% Copyright (C) 2004-2005 Hendri Adriaens
%% ---------------------------------------
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
%%
%% This Current Maintainer of this work is Hendri Adriaens.
%%
%% This work consists of the file xkeyval.dtx and derived files
%% keyval.tex, xkvtxhdr.tex, xkeyval.sty, xkeyval.tex, xkvview.sty,
%% xkvltxp.sty, pst-xkey.tex, pst-xkey.sty, xkveca.cls, xkvecb.cls,
%% xkvesa.sty, xkvesb.sty, xkvesc.sty, xkvex1.tex, xkvex2.tex,
%% xkvex3.tex and xkvex4.tex.
%%
%% The following files constitute the xkeyval bundle and must be
%% distributed as a whole: readme, xkeyval.pdf, keyval.tex,
%% pst-xkey.sty, pst-xkey.tex, xkeyval.sty, xkeyval.tex, xkvview.sty,
%% xkvltxp.sty, xkvtxhdr.tex, pst-xkey.dtx and xkeyval.dtx.
%%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{xkvview}%
  [2005/07/10 v1.4a viewer utility for xkeyval (HA)]
\RequirePackage{xkeyval}
\RequirePackage{longtable}
\DeclareOptionX*{%
  \PackageWarning{xkvview}{Unknown option `\CurrentOption'}%
}
\ProcessOptionsX
\newif\ifXKVV@vwkey
\newif\ifXKVV@colii
\newif\ifXKVV@coliii
\newif\ifXKVV@coliv
\newif\ifXKVV@colv
\newwrite\XKVV@out
\let\XKVV@db\@empty
\define@cmdkeys[XKVV]{xkvview}[XKVV@]{%
  prefix,family,type,default,file,columns,wcolsep,weol}[\@nil]
\define@boolkeys[XKVV]{xkvview}[XKVV@]{view,vlabels,wlabels}[true]
\presetkeys[XKVV]{xkvview}{prefix,family,type,default,file,%
  columns,wcolsep=&,weol=\\,view,vlabels=false,wlabels=false}{}
\def\XKVV@tabulate#1#2#3{%
  \def\XKV@tempa{#3}%
  \@onelevel@sanitize\XKV@tempa
  \XKV@addtolist@x\XKVV@db{#1=\expandafter
    \XKVV@t@bulate\XKV@prefix=\XKV@tfam=#2=\XKV@tempa}%
}
\def\XKVV@t@bulate#1@{#1}
\def\XKV@define@key#1{%
  \@ifnextchar[{\XKV@d@fine@k@y{#1}}{%
    \XKVV@tabulate{#1}{ordinary}{[none]}%
    \expandafter\def\csname\XKV@header#1\endcsname####1%
  }%
}
\def\XKV@d@fine@k@y#1[#2]{%
  \XKVV@tabulate{#1}{ordinary}{#2}%
  \XKV@define@default{#1}{#2}%
  \expandafter\def\csname\XKV@header#1\endcsname##1%
}
\def\XKV@define@cmdkey#1#2[#3]#4{%
  \ifXKV@st
    \XKVV@tabulate{#2}{command}{#3}%
    \XKV@define@default{#2}{#3}%
  \else
    \XKVV@tabulate{#2}{command}{[none]}%
  \fi
  \def\XKV@tempa{\expandafter\def\csname\XKV@header#2\endcsname####1}%
  \begingroup\expandafter\endgroup\expandafter\XKV@tempa\expandafter
    {\expandafter\def\csname#1#2\endcsname{##1}#4}%
}
\def\XKV@d@fine@ch@icekey#1[#2]{%
  \XKVV@tabulate{#1}{choice}{#2}%
  \XKV@define@default{#1}{#2}%
  \XKV@d@fine@ch@ic@key{#1}%
}
\def\XKV@d@fine@ch@ic@key#1{%
  \XKVV@tabulate{#1}{choice}{[none]}%
  \ifXKV@pl\XKV@afterelsefi
    \expandafter\XKV@d@f@ne@ch@ic@k@y
  \else\XKV@afterfi
    \expandafter\XKV@d@f@ne@ch@ic@key
  \fi
  \csname\XKV@header#1\endcsname
}
\def\XKV@d@f@ne@b@olkey#1#2#3#4#5{%
  \expandafter\newif\csname if#3\endcsname
  \ifXKV@st
    \XKVV@tabulate{#2}{boolean}{#4}%
    \XKV@define@default{#2}{#4}%
  \else
    \XKVV@tabulate{#2}{boolean}{[none]}%
  \fi
  \ifXKV@pl
    \def#1##1{\XKV@pltrue\XKV@sttrue
      \XKV@checkchoice[\XKV@resa]{##1}{true,false}#5%
    }%
  \else
    \def#1##1{\XKV@plfalse\XKV@sttrue
      \XKV@checkchoice[\XKV@resa]{##1}{true,false}#5%
    }%
  \fi
}
\def\xkvview#1{%
  \setkeys[XKVV]{xkvview}{#1}%
  \ifx\XKVV@default\@nnil\else\@onelevel@sanitize\XKVV@default\fi
  \ifx\XKVV@columns\@nnil
    \count@5
    \XKVV@coliitrue\XKVV@coliiitrue\XKVV@colivtrue\XKVV@colvtrue
  \else
    \count@\@ne
    \@expandtwoargs\in@{,prefix,}{,\XKVV@columns,}%
    \ifin@\advance\count@\@ne\XKVV@coliitrue\else\XKVV@coliifalse\fi
    \@expandtwoargs\in@{,family,}{,\XKVV@columns,}%
    \ifin@\advance\count@\@ne\XKVV@coliiitrue\else\XKVV@coliiifalse\fi
    \@expandtwoargs\in@{,type,}{,\XKVV@columns,}%
    \ifin@\advance\count@\@ne\XKVV@colivtrue\else\XKVV@colivfalse\fi
    \@expandtwoargs\in@{,default,}{,\XKVV@columns,}%
    \ifin@\advance\count@\@ne\XKVV@colvtrue\else\XKVV@colvfalse\fi
  \fi
  \ifXKVV@view
    \protected@edef\XKV@tempa{\noexpand\begin{longtable}[l]{%
      *\the\count@ l}\normalfont Key\ifXKVV@colii&\normalfont Prefix%
      \fi\ifXKVV@coliii&\normalfont Family\fi\ifXKVV@coliv&\normalfont
      Type\fi\ifXKVV@colv&\normalfont Default\fi\\\noexpand\hline
      \noexpand\endfirsthead\noexpand\multicolumn{\the\count@}{l}{%
      \normalfont\emph{Continued from previous page}}\\\noexpand\hline
      \normalfont Key\ifXKVV@colii&\normalfont Prefix\fi\ifXKVV@coliii
      &\normalfont Family\fi\ifXKVV@coliv&\normalfont Type\fi
      \ifXKVV@colv&\normalfont Default\fi\\\noexpand\hline\noexpand
      \endhead\noexpand\hline\noexpand\multicolumn{\the\count@}{r}{%
      \normalfont\emph{Continued on next page}}\\\noexpand\endfoot
      \noexpand\hline\noexpand\endlastfoot
    }%
    \XKV@toks\expandafter{\XKV@tempa}%
  \fi
  \ifx\XKVV@file\@nnil\else\immediate\openout\XKVV@out\XKVV@file\fi
  \XKV@for@o\XKVV@db\XKV@tempa{%
    \XKVV@vwkeytrue\expandafter\XKVV@xkvview\XKV@tempa\@nil
  }%
  \ifXKVV@view
    \addto@hook\XKV@toks{\end{longtable}}%
    \begingroup\ttfamily\the\XKV@toks\endgroup
  \fi
  \ifx\XKVV@file\@nnil\else\immediate\closeout\XKVV@out\fi
}
\def\XKVV@xkvview#1=#2=#3=#4=#5\@nil{%
  \ifx\XKVV@prefix\@nnil\else
    \def\XKV@tempa{#2}%
    \ifx\XKV@tempa\XKVV@prefix\else\XKVV@vwkeyfalse\fi
  \fi
  \ifx\XKVV@family\@nnil\else
    \def\XKV@tempa{#3}%
    \ifx\XKV@tempa\XKVV@family\else\XKVV@vwkeyfalse\fi
  \fi
  \ifx\XKVV@type\@nnil\else
    \def\XKV@tempa{#4}%
    \ifx\XKV@tempa\XKVV@type\else\XKVV@vwkeyfalse\fi
  \fi
  \ifx\XKVV@default\@nnil\else
    \def\XKV@tempa{#5}%
    \ifx\XKV@tempa\XKVV@default\else\XKVV@vwkeyfalse\fi
  \fi
  \ifXKVV@vwkey
    \ifXKVV@view
      \edef\XKV@tempa{%
        #1\ifXKVV@colii&#2\fi\ifXKVV@coliii&#3\fi
        \ifXKVV@coliv&#4\fi\ifXKVV@colv&#5\fi
        \ifXKVV@vlabels\noexpand\label{#2-#3-#1}\fi
      }%
      \expandafter\addto@hook\expandafter
        \XKV@toks\expandafter{\XKV@tempa\\}%
    \fi
    \ifx\XKVV@file\@nnil\else
      \immediate\write\XKVV@out{%
        #1\ifXKVV@colii\XKVV@wcolsep#2\fi
        \ifXKVV@coliii\XKVV@wcolsep#3\fi
        \ifXKVV@coliv\XKVV@wcolsep#4\fi
        \ifXKVV@colv\XKVV@wcolsep#5\fi
        \ifXKVV@wlabels\string\label{#2-#3-#1}\fi
        \expandafter\noexpand\XKVV@weol
      }%
    \fi
  \fi
}
\endinput
%%
%% End of file `xkvview.sty'.
